﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace Embedded_Sensor_Cloud
{
    public class MockPlugin : IPlugin
    {


        public string Name
        {
            get { return "MockPlugin"; }
        }

        public string Version
        {
            get { return "1.0"; }
        }

        public bool ExecutePlugin(Request req)
        {
            Socket socket = req.getSocket();
            Response r1 = new Response(socket);
            r1.StatusCode = 200;
            r1.StatusText = "OK";
            r1.ContentType = "text/html";
            r1.Data = "<html><head></head><body><h1>Testantwort</h1></body></html>";
            //r1.Data = "<html><head></head><body><h1>Error 404</h1><h2>Page not found!</h2></body></html>";
            //r1.Data = "<html><body><form action='' method='post'><input name='var1' type='text' /></form></body></html>";
            bool ok = r1.sendResponse();
            socket.Close();

            if (ok)
                return true;
            else
                return false;
        }
    }
}
